package com.ly.heart.domain;

import java.util.Date;
import java.util.List;
import java.util.Objects;

import com.baomidou.mybatisplus.annotation.IdType;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.ly.common.core.domain.ActCurrentTaskVo;
import com.ly.common.core.domain.BaseVo;
import lombok.Data;
import com.ly.common.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

/**
 * 供应商对象 erp_supplier_info
 *
 * @author cxl
 * @date 2024-06-16
 */
@TableName ( "erp_supplier_info" )
@ApiModel ( value = "供应商", description = "供应商" )
@Data
@JsonInclude ( JsonInclude.Include.ALWAYS )
public class SupplierEntity extends BaseVo {


    /**
     * id
     */
    @TableId ( type = IdType.INPUT )
    private String id;

    /**
     * 创建组织
     */
    @ApiModelProperty ( "创建组织" )
    @TableField ( "create_dept" )
    @Excel ( name = "创建组织" )
    private String createDept;

    /**
     * 使用组织
     */
    @ApiModelProperty ( "使用组织" )
    @TableField ( "use_dept" )
    @Excel ( name = "使用组织" )
    private String useDept;

    /**
     * 注册编码
     */
    @ApiModelProperty ( "注册编码" )
    @TableField ( "register_code" )
    @Excel ( name = "注册编码" )
    private String registerCode;

    /**
     * 供应商编码
     */
    @ApiModelProperty ( "供应商编码" )
    @TableField ( "supplier_code" )
    @Excel ( name = "供应商编码" )
    private String supplierCode;

    /**
     * 供应商名称
     */
    @ApiModelProperty ( "供应商名称" )
    @TableField ( "supplier_name" )
    @Excel ( name = "供应商名称" )
    private String supplierName;

    /**
     * 简称
     */
    @ApiModelProperty ( "简称" )
    @TableField ( "for_short" )
    @Excel ( name = "简称" )
    private String forShort;

    /**
     * 国家id
     */
    @ApiModelProperty ( "国家id" )
    @TableField ( "nation_id" )
    @Excel ( name = "国家id" )
    private String nationId;

    @ApiModelProperty ( "国家名称" )
    @TableField(exist = false)
    private String nationName;

    /**
     * 省份Id
     */
    @ApiModelProperty ( "省份Id" )
    @TableField ( "provinces_id" )
    @Excel ( name = "省份Id" )
    private String provincesId;

    @ApiModelProperty ( "省份名称" )
    @TableField(exist = false)
    private String provincesName;

    /**
     * 城市Id
     */
    @ApiModelProperty ( "城市Id" )
    @TableField ( "city_id" )
    @Excel ( name = "城市Id" )
    private String cityId;

    @ApiModelProperty ( "城市名称" )
    @TableField(exist = false)
    private String cityName;

    /**
     * 区县Id
     */
    @ApiModelProperty ( "区县Id" )
    @TableField ( "county_id" )
    @Excel ( name = "区县Id" )
    private String countyId;

    /**
     * 通讯地址
     */
    @ApiModelProperty ( "通讯地址" )
    @TableField ( "mailing_address" )
    @Excel ( name = "通讯地址" )
    private String mailingAddress;

    /**
     * 邮政编码
     */
    @ApiModelProperty ( "邮政编码" )
    @TableField ( "zip_code" )
    @Excel ( name = "邮政编码" )
    private String zipCode;

    /**
     * 语言
     */
    @ApiModelProperty ( "语言" )
    @TableField ( "language" )
    @Excel ( name = "语言" )
    private String language;

    /**
     * 公司网址
     */
    @ApiModelProperty ( "公司网址" )
    @TableField ( "company_website" )
    @Excel ( name = "公司网址" )
    private String companyWebsite;

    /**
     * 行业
     */
    @ApiModelProperty ( "行业" )
    @TableField ( "industry" )
    @Excel ( name = "行业" )
    private String industry;

    /**
     * 创立日期
     */
    @ApiModelProperty ( "创立日期" )
    @TableField ( "establish_date" )
    @JsonFormat ( pattern = "yyyy-MM-dd" )
    @Excel ( name = "创立日期", width = 30, dateFormat = "yyyy-MM-dd" )
    private Date establishDate;

    /**
     * 法人代表
     */
    @ApiModelProperty ( "法人代表" )
    @TableField ( "legal_representative" )
    @Excel ( name = "法人代表" )
    private String legalRepresentative;

    /**
     * 注册资金
     */
    @ApiModelProperty ( "注册资金" )
    @TableField ( "registered_capital" )
    @Excel ( name = "注册资金" )
    private String registeredCapital;

    /**
     * 工商登记号
     */
    @ApiModelProperty ( "工商登记号" )
    @TableField ( "registration_number" )
    @Excel ( name = "工商登记号" )
    private String registrationNumber;

    /**
     * 生产经营许可证
     */
    @ApiModelProperty ( "生产经营许可证" )
    @TableField ( "production_license" )
    @Excel ( name = "生产经营许可证" )
    private String productionLicense;

    /**
     * 统一社会信用代码
     */
    @ApiModelProperty ( "统一社会信用代码" )
    @TableField ( "credit_code" )
    @Excel ( name = "统一社会信用代码" )
    private String creditCode;

    /**
     * 注册地址
     */
    @ApiModelProperty ( "注册地址" )
    @TableField ( "company_registered_address" )
    @Excel ( name = "注册地址" )
    private String companyRegisteredAddress;

    /**
     * 负责部门
     */
    @ApiModelProperty ( "负责部门" )
    @TableField ( "charge_dept" )
    @Excel ( name = "负责部门" )
    private String chargeDept;

    /**
     * 负责人
     */
    @ApiModelProperty ( "负责人" )
    @TableField ( "charge_person" )
    @Excel ( name = "负责人" )
    private String chargePerson;

    /**
     * 供应商分类
     */
    @ApiModelProperty ( "供应商分类" )
    @TableField ( "classification" )
    @Excel ( name = "供应商分类" )
    private String classification;

    /**
     * 供应类别
     */
    @ApiModelProperty ( "供应类别" )
    @TableField ( "supply_category" )
    @Excel ( name = "供应类别" )
    private String supplyCategory;

    /**
     * 供应商等级
     */
    @ApiModelProperty ( "供应商等级" )
    @TableField ( "supplier_level" )
    @Excel ( name = "供应商等级" )
    private String supplierLevel;

    /**
     * 供应商分组
     */
    @ApiModelProperty ( "供应商分组" )
    @TableField ( "supplier_group" )
    @Excel ( name = "供应商分组" )
    private String supplierGroup;

    /**
     * 公司类别
     */
    @ApiModelProperty ( "公司类别" )
    @TableField ( "company_category" )
    @Excel ( name = "公司类别" )
    private String companyCategory;

    /**
     * 公司性质
     */
    @ApiModelProperty ( "公司性质" )
    @TableField ( "company_nature" )
    @Excel ( name = "公司性质" )
    private String companyNature;

    /**
     * 公司规模
     */
    @ApiModelProperty ( "公司规模" )
    @TableField ( "company_size" )
    @Excel ( name = "公司规模" )
    private String companySize;

    /**
     * 对应组织
     */
    @ApiModelProperty ( "对应组织" )
    @TableField ( "corresponding_organization" )
    @Excel ( name = "对应组织" )
    private String correspondingOrganization;

    /**
     * 对应集团供应商
     */
    @ApiModelProperty ( "对应集团供应商" )
    @TableField ( "group_supplier" )
    @Excel ( name = "对应集团供应商" )
    private String groupSupplier;

    /**
     * 采购组
     */
    @ApiModelProperty ( "采购组" )
    @TableField ( "purchase_group" )
    @Excel ( name = "采购组" )
    private String purchaseGroup;

    /**
     * 默认价目表
     */
    @ApiModelProperty ( "默认价目表" )
    @TableField ( "default_price_list" )
    @Excel ( name = "默认价目表" )
    private String defaultPriceList;

    /**
     * 业务状态
     */
    @ApiModelProperty ( "业务状态" )
    @TableField ( "business_state" )
    @Excel ( name = "业务状态" )
    private String businessState;

    /**
     * 冻结范围
     */
    @ApiModelProperty ( "冻结范围" )
    @TableField ( "freeze_scope" )
    @Excel ( name = "冻结范围" )
    private String freezeScope;

    /**
     * 冻结日期
     */
    @ApiModelProperty ( "冻结日期" )
    @TableField ( "freeze_date" )
    @JsonFormat ( pattern = "yyyy-MM-dd" )
    @Excel ( name = "冻结日期", width = 30, dateFormat = "yyyy-MM-dd" )
    private Date freezeDate;

    /**
     * 保证金比例
     */
    @ApiModelProperty ( "保证金比例" )
    @TableField ( "ensure_rate" )
    @Excel ( name = "保证金比例" )
    private String ensureRate;

    /**
     * 供货方
     */
    @ApiModelProperty ( "供货方" )
    @TableField ( "supply" )
    @Excel ( name = "供货方" )
    private String supply;

    /**
     * VMI业务
     */
    @ApiModelProperty ( "VMI业务" )
    @TableField ( "is_vmi" )
    @Excel ( name = "VMI业务" )
    private Boolean isVmi;

    /**
     * 默认联系人
     */
    @ApiModelProperty ( "默认联系人" )
    @TableField ( "default_contracts" )
    @Excel ( name = "默认联系人" )
    private String defaultContracts;

    /**
     * 冻结人
     */
    @ApiModelProperty ( "冻结人" )
    @TableField ( "freezing_person" )
    @Excel ( name = "冻结人" )
    private String freezingPerson;

    /**
     * 汇总公司
     */
    @ApiModelProperty ( "汇总公司" )
    @TableField ( "summary_company" )
    @Excel ( name = "汇总公司" )
    private String summaryCompany;

    /**
     * 默认折扣表
     */
    @ApiModelProperty ( "默认折扣表" )
    @TableField ( "default_discount" )
    @Excel ( name = "默认折扣表" )
    private String defaultDiscount;

    /**
     * VMI仓库
     */
    @ApiModelProperty ( "VMI仓库" )
    @TableField ( "vmi_warehouse" )
    @Excel ( name = "VMI仓库" )
    private String vmiWarehouse;

    /**
     * 启用供应商协同
     */
    @ApiModelProperty ( "启用供应商协同" )
    @TableField ( "enable_coordination" )
    @Excel ( name = "启用供应商协同" )
    private Boolean enableCoordination;

    /**
     * 对应客户
     */
    @ApiModelProperty ( "对应客户" )
    @TableField ( "corresponding_customer" )
    @Excel ( name = "对应客户" )
    private String correspondingCustomer;

    /**
     * 税分类
     */
    @ApiModelProperty ( "税分类" )
    @TableField ( "tax_type" )
    @Excel ( name = "税分类" )
    private String taxType;

    /**
     * 描述
     */
    @ApiModelProperty ( "描述" )
    @TableField ( "desc_info" )
    @Excel ( name = "描述" )
    private String descInfo;

    /**
     * 收款方
     */
    @ApiModelProperty ( "收款方" )
    @TableField ( "payee" )
    @Excel ( name = "收款方" )
    private String payee;

    /**
     * 单次预付额度
     */
    @ApiModelProperty ( "单次预付额度" )
    @TableField ( "single_prepayment_limit" )
    @Excel ( name = "单次预付额度" )
    private String singlePrepaymentLimit;

    /**
     * 默认税率
     */
    @ApiModelProperty ( "默认税率" )
    @TableField ( "default_tax" )
    @Excel ( name = "默认税率" )
    private String defaultTax;

    /**
     * 付款条件
     */
    @ApiModelProperty ( "付款条件" )
    @TableField ( "payment_terms" )
    @Excel ( name = "付款条件" )
    private String paymentTerms;

    /**
     * 发票类型
     */
    @ApiModelProperty ( "发票类型" )
    @TableField ( "invoice_type" )
    @Excel ( name = "发票类型" )
    private String invoiceType;

    /**
     * 结算方式
     */
    @ApiModelProperty ( "结算方式" )
    @TableField ( "balance_method" )
    @Excel ( name = "结算方式" )
    private String balanceMethod;

    /**
     * 经营类型
     */
    @ApiModelProperty ( "经营类型" )
    @TableField ( "manage_type" )
    @Excel ( name = "经营类型" )
    private String manageType;

    /**
     * 计算币别
     */
    @ApiModelProperty ( "计算币别" )
    @TableField ( "balance_currency" )
    @Excel ( name = "计算币别" )
    private String balanceCurrency;

    /**
     * 税务登记号
     */
    @ApiModelProperty ( "税务登记号" )
    @TableField ( "tax_number" )
    @Excel ( name = "税务登记号" )
    private String taxNumber;

    /**
     * 结算方
     */
    @ApiModelProperty ( "结算方" )
    @TableField ( "balance_party" )
    @Excel ( name = "结算方" )
    private String balanceParty;

    /**
     * 创建人Id
     */
    @ApiModelProperty ( "创建人Id" )
    @TableField ( "user_id" )
    @Excel ( name = "创建人Id" )
    private String userId;

    @ApiModelProperty ( "创建时间" )
    @TableField ( "create_time" )
    @JsonFormat ( pattern = "yyyy-MM-dd HH:mm:ss" )
    private Date createTime;

    /**
     * 修改人id
     */
    @ApiModelProperty ( "修改人id" )
    @TableField ( "change_id" )
    @Excel ( name = "修改人id" )
    private String changeId;

    /**
     * 更新时间
     */
    @ApiModelProperty ( "更新时间" )
    @TableField ( "change_time" )
    @JsonFormat ( pattern = "yyyy-MM-dd HH:mm:ss" )
    private Date changeTime;

    /**
     * 逻辑删除
     */
    @ApiModelProperty ( "逻辑删除" )
    @TableField ( "is_used" )
    @Excel ( name = "逻辑删除" )
    private Integer isUsed;

    /**
     * 审核日期
     */
    @ApiModelProperty ( "审核日期" )
    @TableField ( "examine_time" )
    @JsonFormat ( pattern = "yyyy-MM-dd" )
    @Excel ( name = "审核日期", width = 30, dateFormat = "yyyy-MM-dd" )
    private Date examineTime;

    /**
     * 审核人
     */
    @ApiModelProperty ( "审核人" )
    @TableField ( "examine_id" )
    @Excel ( name = "审核人" )
    private String examineId;

    /**
     * 数据状态
     */
    @ApiModelProperty ( "数据状态" )
    @TableField ( "data_state" )
    @Excel ( name = "数据状态" )
    private String dataState;

    /**
     * 禁用日期
     */
    @ApiModelProperty ( "禁用日期" )
    @TableField ( "disabled_date" )
    @JsonFormat ( pattern = "yyyy-MM-dd" )
    @Excel ( name = "禁用日期", width = 30, dateFormat = "yyyy-MM-dd" )
    private Date disabledDate;

    /**
     * 禁用人
     */
    @ApiModelProperty ( "禁用人" )
    @TableField ( "disabled_id" )
    @Excel ( name = "禁用人" )
    private String disabledId;

    /**
     * 禁用状态
     */
    @ApiModelProperty ( "禁用状态" )
    @TableField ( "disabled_state" )
    @Excel ( name = "禁用状态" )
    private String disabledState;

    @ApiModelProperty ( "流程实例id" )
    @TableField ( "instance_id" )
    private String instanceId;

    @ApiModelProperty ( "流程状态" )
    @TableField ( "state" )
    private String state;

    @ApiModelProperty ( "流程状态名称" )
    @TableField ( exist = false )
    private String stateName;

    @ApiModelProperty ( "是否禁用；1：是；2：否" )
    @TableField ( "is_disabled" )
    @Excel ( name = "是否禁用" )
    private Integer isDisabled;

    @ApiModelProperty ("是否发送金蝶")
    @TableField ("is_send")
    @Excel (name = "是否发送金蝶")
    private Integer isSend;




    @ApiModelProperty ( "业务type" )
    @TableField ( exist = false )
    private String businessType;

    @ApiModelProperty ( "流程模型id" )
    @TableField ( exist = false )
    private String modelId;

    @ApiModelProperty ( "供应商联系人" )
    @TableField ( exist = false )
    private List<SupplierContactsEntity> contracts;

    @ApiModelProperty ( "供应商组织信息" )
    @TableField ( exist = false )
    private List<SupplierOrganizationEntity> organizations;

    @ApiModelProperty ( "银行账户信息" )
    @TableField ( exist = false )
    private List<BankEntity> banks;

    @ApiModelProperty ( "当下审批人" )
    @TableField ( exist = false )
    private String approvedUser;

    @ApiModelProperty ( "审批内容" )
    @TableField ( exist = false )
    private String remark;

    @ApiModelProperty ( "当前任务信息" )
    @TableField ( exist = false )
    private ActCurrentTaskVo currentTask;

    public SupplierEntity setStateName ( String state ) {
        if ( Objects.nonNull ( state ) ) {
            switch ( state ) {
                case "-1":
                    stateName = "暂存";
                    break;
                case "0":
                    stateName = "审核中";
                    break;
                case "2":
                    stateName = "已完成";
                    break;
            }
        }
        this.state = state;
        return this;
    }

}
